Devices > Remote Devices > Device Template Files > Reference Methods > Unit Conversion Examples

Unit Conversion Examples

This topic provides numerous useful examples of the various ways you can use reference methods in your device template files to perform conversions with constant values and/or reference data group element values. A sample device template file using each example is available upon request; it can be loaded to a DDS and used to test your reference methods. It is called ReferenceTester.dtf. For a list of available units, see PNT Engineering Units.

See the following subsections for details:

For information about example data group elements and values used below, see Example Values.

Unit Conversion (A)

The following example references the data group element rawDur and converts the value from seconds to minutes ("min"). The result is 24.25 because 1455 is divided by 60.

<UnitA desc="Units Sec to Min Method A" readOnly="true" type="r4" ref="rawDur" units="min"/>

Useful attributes to know are ref and units.

Unit Conversion (B)

The following example uses two child elements to compute a unit conversion. The first child element references the operation opAssignId and the data group element rawDur to assign the current value of rawDur as the initial value for UnitB. The second child element references the operation opUnitConversion to convert the initial value from its source units (seconds) to destination units (minutes). The result is 24.25 because 1455 is divided by 60.

<UnitB desc="Units Sec to Min Method B" readOnly="true" type="r4" units="min" isRef="1">

<ref prec="0" refOp="opAssignId" deid="rawDur"/>

<ref prec="1" refOp="opUnitConversion" srcUnits="sec" destUnits="min"/>

</UnitB>

Useful attributes to know are isRef, units, prec, refOp, deid, value, srcUnits, and destUnits. A useful element to know is ref.


Let us know how we can improve this topic.

CygNet at weatherford.com

© 2020 Weatherford. All rights reserved.